﻿namespace ACCOUNTING
{
    using ACCOUNTING.LVY.Business;
    using ACCOUNTING.My;
    using ACCOUNTING.My.Resources;
    using Microsoft.VisualBasic;
    using Microsoft.VisualBasic.CompilerServices;
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Diagnostics;
    using System.Drawing;
    using System.Runtime.CompilerServices;
    using System.Windows.Forms;

    [DesignerGenerated]
    public class Frm_RptBangKeHoaHong : Form
    {
        private static List<WeakReference> __ENCList = new List<WeakReference>();
        [AccessedThroughProperty("CboDonVi")]
        private ComboBox _CboDonVi;
        [AccessedThroughProperty("CmdCancel")]
        private Button _CmdCancel;
        [AccessedThroughProperty("CmdOK")]
        private Button _CmdOK;
        [AccessedThroughProperty("GroupBox1")]
        private GroupBox _GroupBox1;
        [AccessedThroughProperty("Label13")]
        private Label _Label13;
        [AccessedThroughProperty("Label2")]
        private Label _Label2;
        [AccessedThroughProperty("Label3")]
        private Label _Label3;
        [AccessedThroughProperty("OptInChiTiet")]
        private RadioButton _OptInChiTiet;
        [AccessedThroughProperty("OptInTongHop")]
        private RadioButton _OptInTongHop;
        [AccessedThroughProperty("Panel1")]
        private Panel _Panel1;
        [AccessedThroughProperty("TxtDenNgay")]
        private DateTimePicker _TxtDenNgay;
        [AccessedThroughProperty("TxtTuNgay")]
        private DateTimePicker _TxtTuNgay;
        private IContainer components;
        private bool mAllowAdd;
        private bool mAllowDel;
        private bool mAllowEdit;
        private bool mAllowView;
        private clsHoaHong objHH;

        public Frm_RptBangKeHoaHong()
        {
            base.Load += new EventHandler(this.Frm_RptBangKeHoaHong_Load);
            List<WeakReference> list = __ENCList;
            lock (list)
            {
                __ENCList.Add(new WeakReference(this));
            }
            this.objHH = new clsHoaHong();
            this.InitializeComponent();
        }

        private void CmdCancel_Click(object sender, EventArgs e)
        {
            this.Dispose();
        }

        private void CmdOK_Click(object sender, EventArgs e)
        {
            if (this.OptInTongHop.Checked)
            {
                this.PrintReport();
            }
            else
            {
                this.PrintReportDetails();
            }
        }

        [DebuggerNonUserCode]
        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void Frm_RptBangKeHoaHong_Load(object sender, EventArgs e)
        {
            LVYModule.GetUserRight(ref this.mAllowView, ref this.mAllowDel, ref this.mAllowEdit, ref this.mAllowAdd, Conversions.ToString(this.Tag), modGeneral.H_USERNAME);
            if (!this.mAllowView)
            {
                LVYModule.ShowWarning(modGeneral.Tranlated("Bạn kh\x00f4ng c\x00f3 quyền xem, li\x00ean hệ với người quản trị để biết th\x00eam chi tiết.", ""));
                this.Dispose();
            }
            else
            {
                BuildComboModule.BuildCombo(this.CboDonVi, modGeneral.ListDanhMuc.DonVi, true, "", "");
                this.CboDonVi.SelectedValue = modGeneral.H_CLIENT;
                this.TxtTuNgay.Text = "01/" + LVYModule.sRight("00" + Conversions.ToString(DateAndTime.Month(DateAndTime.Today)), 2) + "/" + Conversions.ToString(DateAndTime.Year(DateAndTime.Today));
            }
        }

        [DebuggerStepThrough]
        private void InitializeComponent()
        {
            ComponentResourceManager manager = new ComponentResourceManager(typeof(Frm_RptBangKeHoaHong));
            this.GroupBox1 = new GroupBox();
            this.OptInChiTiet = new RadioButton();
            this.OptInTongHop = new RadioButton();
            this.CboDonVi = new ComboBox();
            this.Label2 = new Label();
            this.TxtDenNgay = new DateTimePicker();
            this.TxtTuNgay = new DateTimePicker();
            this.Label3 = new Label();
            this.Label13 = new Label();
            this.CmdCancel = new Button();
            this.CmdOK = new Button();
            this.Panel1 = new Panel();
            this.GroupBox1.SuspendLayout();
            this.Panel1.SuspendLayout();
            this.SuspendLayout();
            this.GroupBox1.BackColor = Color.Transparent;
            this.GroupBox1.Controls.Add(this.OptInChiTiet);
            this.GroupBox1.Controls.Add(this.OptInTongHop);
            this.GroupBox1.Controls.Add(this.CboDonVi);
            this.GroupBox1.Controls.Add(this.Label2);
            this.GroupBox1.Controls.Add(this.TxtDenNgay);
            this.GroupBox1.Controls.Add(this.TxtTuNgay);
            this.GroupBox1.Controls.Add(this.Label3);
            this.GroupBox1.Controls.Add(this.Label13);
            this.GroupBox1.Dock = DockStyle.Fill;
            Point point = new Point(0, 0);
            this.GroupBox1.Location = point;
            this.GroupBox1.Name = "GroupBox1";
            Size size = new Size(0x18a, 140);
            this.GroupBox1.Size = size;
            this.GroupBox1.TabIndex = 0;
            this.GroupBox1.TabStop = false;
            this.GroupBox1.Text = "T\x00f9y chọn";
            this.OptInChiTiet.AutoSize = true;
            point = new Point(0x116, 0x5f);
            this.OptInChiTiet.Location = point;
            this.OptInChiTiet.Name = "OptInChiTiet";
            size = new Size(0x44, 0x11);
            this.OptInChiTiet.Size = size;
            this.OptInChiTiet.TabIndex = 0x4a;
            this.OptInChiTiet.Text = "In chi tiết";
            this.OptInChiTiet.UseVisualStyleBackColor = true;
            this.OptInTongHop.AutoSize = true;
            this.OptInTongHop.Checked = true;
            point = new Point(0x69, 0x5f);
            this.OptInTongHop.Location = point;
            this.OptInTongHop.Name = "OptInTongHop";
            size = new Size(0x4f, 0x11);
            this.OptInTongHop.Size = size;
            this.OptInTongHop.TabIndex = 0x49;
            this.OptInTongHop.TabStop = true;
            this.OptInTongHop.Text = "In tổng hợp";
            this.OptInTongHop.UseVisualStyleBackColor = true;
            this.CboDonVi.DropDownStyle = ComboBoxStyle.DropDownList;
            this.CboDonVi.FormattingEnabled = true;
            point = new Point(0x69, 0x20);
            this.CboDonVi.Location = point;
            this.CboDonVi.Name = "CboDonVi";
            size = new Size(0x103, 0x15);
            this.CboDonVi.Size = size;
            this.CboDonVi.TabIndex = 0x48;
            this.Label2.AutoSize = true;
            point = new Point(0x2f, 0x23);
            this.Label2.Location = point;
            this.Label2.Name = "Label2";
            size = new Size(0x26, 13);
            this.Label2.Size = size;
            this.Label2.TabIndex = 0x47;
            this.Label2.Text = "Đơn vị";
            this.TxtDenNgay.Format = DateTimePickerFormat.Short;
            point = new Point(0x116, 0x41);
            this.TxtDenNgay.Location = point;
            this.TxtDenNgay.Name = "TxtDenNgay";
            size = new Size(0x56, 20);
            this.TxtDenNgay.Size = size;
            this.TxtDenNgay.TabIndex = 0x44;
            this.TxtTuNgay.Format = DateTimePickerFormat.Short;
            point = new Point(0x69, 0x41);
            this.TxtTuNgay.Location = point;
            this.TxtTuNgay.Name = "TxtTuNgay";
            size = new Size(0x52, 20);
            this.TxtTuNgay.Size = size;
            this.TxtTuNgay.TabIndex = 0x43;
            DateTime time = new DateTime(0x7d7, 11, 1, 0, 0, 0, 0);
            this.TxtTuNgay.Value = time;
            this.Label3.AutoSize = true;
            point = new Point(0xce, 0x45);
            this.Label3.Location = point;
            this.Label3.Name = "Label3";
            size = new Size(0x35, 13);
            this.Label3.Size = size;
            this.Label3.TabIndex = 70;
            this.Label3.Text = "Đến ng\x00e0y";
            this.Label13.AutoSize = true;
            point = new Point(0x2f, 0x45);
            this.Label13.Location = point;
            this.Label13.Name = "Label13";
            size = new Size(0x2e, 13);
            this.Label13.Size = size;
            this.Label13.TabIndex = 0x45;
            this.Label13.Text = "Từ ng\x00e0y";
            this.CmdCancel.DialogResult = DialogResult.Cancel;
            this.CmdCancel.Image = (Image) manager.GetObject("CmdCancel.Image");
            this.CmdCancel.ImageAlign = ContentAlignment.MiddleLeft;
            point = new Point(0x120, 6);
            this.CmdCancel.Location = point;
            this.CmdCancel.Name = "CmdCancel";
            size = new Size(0x52, 0x18);
            this.CmdCancel.Size = size;
            this.CmdCancel.TabIndex = 0x41;
            this.CmdCancel.Text = "&Tho\x00e1t";
            this.CmdCancel.UseVisualStyleBackColor = true;
            this.CmdOK.Image = (Image) manager.GetObject("CmdOK.Image");
            this.CmdOK.ImageAlign = ContentAlignment.MiddleLeft;
            point = new Point(0xc9, 6);
            this.CmdOK.Location = point;
            this.CmdOK.Name = "CmdOK";
            size = new Size(0x51, 0x18);
            this.CmdOK.Size = size;
            this.CmdOK.TabIndex = 0x40;
            this.CmdOK.Text = "&Chọn";
            this.CmdOK.UseVisualStyleBackColor = true;
            this.Panel1.BackColor = Color.Transparent;
            this.Panel1.Controls.Add(this.CmdOK);
            this.Panel1.Controls.Add(this.CmdCancel);
            this.Panel1.Dock = DockStyle.Bottom;
            point = new Point(0, 140);
            this.Panel1.Location = point;
            this.Panel1.Name = "Panel1";
            size = new Size(0x18a, 0x25);
            this.Panel1.Size = size;
            this.Panel1.TabIndex = 0x42;
            SizeF ef = new SizeF(6f, 13f);
            this.AutoScaleDimensions = ef;
            this.AutoScaleMode = AutoScaleMode.Font;
            this.BackgroundImage = ACCOUNTING.My.Resources.Resources.background;
            size = new Size(0x18a, 0xb1);
            this.ClientSize = size;
            this.ControlBox = false;
            this.Controls.Add(this.GroupBox1);
            this.Controls.Add(this.Panel1);
            this.FormBorderStyle = FormBorderStyle.FixedDialog;
            this.Name = "Frm_RptBangKeHoaHong";
            this.StartPosition = FormStartPosition.CenterScreen;
            this.Tag = "BC-BH10             ";
            this.Text = "BANG KE HOA HONG";
            this.GroupBox1.ResumeLayout(false);
            this.GroupBox1.PerformLayout();
            this.Panel1.ResumeLayout(false);
            this.ResumeLayout(false);
        }

        public void PrintReport()
        {
            this.Cursor = Cursors.WaitCursor;
            DataTable dataTable = this.objHH.GetDataPrintHoaHong(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.CboDonVi.SelectedValue), "", modGeneral.TypeOfValue.Nothing).ToString().Trim(), LVYModule.Date2Char(this.TxtTuNgay.Text), LVYModule.Date2Char(this.TxtDenNgay.Text), 0);
            if (dataTable.Rows.Count == 0)
            {
                LVYModule.ShowWarning(modGeneral.Tranlated("Kh\x00f4ng c\x00f3 dữ liệu !", ""));
            }
            else
            {
                Rpt_BangKeTienHoaHong hong = new Rpt_BangKeTienHoaHong();
                try
                {
                    hong.SetDataSource(dataTable);
                    if (modGeneral.H_LANGUAGE == "VIET")
                    {
                        hong.SetParameterValue(0, modGeneral.Tranlated(modGeneral.H_COMPANYNAMEVIET, ""));
                    }
                    else
                    {
                        hong.SetParameterValue(0, modGeneral.Tranlated(modGeneral.H_COMPANYNAMEANH, ""));
                    }
                    hong.SetParameterValue(1, modGeneral.Tranlated("Địa chỉ", "") + ": " + modGeneral.H_ADDRESS);
                    hong.SetParameterValue(2, modGeneral.Tranlated("M\x00e3 số thuế", "") + ": " + modGeneral.H_TAXCODE);
                    hong.SetParameterValue(3, modGeneral.Tranlated("Điện thoại", "") + ": " + modGeneral.H_TELEPHONE);
                    hong.SetParameterValue(4, modGeneral.Tranlated("Fax", "") + ": " + modGeneral.H_FAX);
                    hong.SetParameterValue(5, modGeneral.Tranlated("BẢNG K\x00ca HOA HỒNG", ""));
                    hong.SetParameterValue(6, modGeneral.Tranlated("Từ ng\x00e0y", "") + " : " + this.TxtTuNgay.Text);
                    hong.SetParameterValue(7, modGeneral.Tranlated("Đến ng\x00e0y", "") + " : " + this.TxtDenNgay.Text);
                    hong.SetParameterValue(8, modGeneral.Tranlated("Số chứng từ", ""));
                    hong.SetParameterValue(9, modGeneral.Tranlated("Ng\x00e0y", ""));
                    hong.SetParameterValue(10, modGeneral.Tranlated("Chứng từ b\x00e1n", ""));
                    hong.SetParameterValue(11, modGeneral.Tranlated("Số h\x00f3a đơn", ""));
                    hong.SetParameterValue(12, modGeneral.Tranlated("Kh\x00e1ch h\x00e0ng", ""));
                    hong.SetParameterValue(13, modGeneral.Tranlated("Hoa hồng", ""));
                    hong.SetParameterValue(14, modGeneral.Tranlated("STT", ""));
                    hong.SetParameterValue(15, modGeneral.Tranlated("Ng\x00e0y .... th\x00e1ng .... năm ............", ""));
                    hong.SetParameterValue(0x10, modGeneral.Tranlated("Lập biểu", ""));
                    hong.SetParameterValue(0x11, modGeneral.Tranlated("Thu lại", ""));
                    hong.SetParameterValue(0x12, modGeneral.Tranlated("C\x00f2n lại", ""));
                    hong.SetParameterValue(0x13, modGeneral.Tranlated("Tổng cộng", ""));
                    MyProject.Forms.Frm_ViewReport.ReportViewer.ReportSource = hong;
                    MyProject.Forms.Frm_ViewReport.ReportViewer.DisplayGroupTree = false;
                    this.Cursor = Cursors.Default;
                    MyProject.Forms.Frm_ViewReport.ShowDialog();
                }
                catch (Exception exception1)
                {
                    ProjectData.SetProjectError(exception1);
                    Exception exception = exception1;
                    MessageBox.Show(exception.Message.ToString());
                    ProjectData.ClearProjectError();
                }
            }
        }

        public void PrintReportDetails()
        {
            this.Cursor = Cursors.WaitCursor;
            DataTable dataTable = this.objHH.GetDataPrintHoaHong(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.CboDonVi.SelectedValue), "", modGeneral.TypeOfValue.Nothing).ToString().Trim(), LVYModule.Date2Char(this.TxtTuNgay.Text), LVYModule.Date2Char(this.TxtDenNgay.Text), 1);
            if (dataTable.Rows.Count == 0)
            {
                LVYModule.ShowWarning(modGeneral.Tranlated("Kh\x00f4ng c\x00f3 dữ liệu !", ""));
            }
            else
            {
                Rpt_BangKeHoaHongChiTiet tiet = new Rpt_BangKeHoaHongChiTiet();
                try
                {
                    tiet.Subreports[0].SetDataSource(modGeneral.H_DATACOMPANY);
                    tiet.SetDataSource(dataTable);
                    if (modGeneral.H_LANGUAGE == "VIET")
                    {
                        tiet.SetParameterValue(0, modGeneral.Tranlated(modGeneral.H_COMPANYNAMEVIET, ""));
                    }
                    else
                    {
                        tiet.SetParameterValue(0, modGeneral.Tranlated(modGeneral.H_COMPANYNAMEANH, ""));
                    }
                    tiet.SetParameterValue(1, modGeneral.Tranlated("Địa chỉ", "") + ": " + modGeneral.H_ADDRESS);
                    tiet.SetParameterValue(2, modGeneral.Tranlated("M\x00e3 số thuế", "") + ": " + modGeneral.H_TAXCODE);
                    tiet.SetParameterValue(3, modGeneral.Tranlated("Điện thoại", "") + ": " + modGeneral.H_TELEPHONE);
                    tiet.SetParameterValue(4, modGeneral.Tranlated("Fax", "") + ": " + modGeneral.H_FAX);
                    tiet.SetParameterValue(5, modGeneral.Tranlated("BẢNG K\x00ca HOA HỒNG", ""));
                    tiet.SetParameterValue(6, modGeneral.Tranlated("Từ ng\x00e0y", "") + " : " + this.TxtTuNgay.Text);
                    tiet.SetParameterValue(7, modGeneral.Tranlated("Đến ng\x00e0y", "") + " : " + this.TxtDenNgay.Text);
                    tiet.SetParameterValue(8, modGeneral.Tranlated("Ng\x00e0y", ""));
                    tiet.SetParameterValue(9, modGeneral.Tranlated("Số chứng từ", ""));
                    tiet.SetParameterValue(10, modGeneral.Tranlated("H\x00f3a đơn", ""));
                    tiet.SetParameterValue(11, modGeneral.Tranlated("C\x00f2n lại", ""));
                    tiet.SetParameterValue(12, modGeneral.Tranlated("Kh\x00e1ch h\x00e0ng", ""));
                    tiet.SetParameterValue(13, modGeneral.Tranlated("M\x00e3 h\x00e0ng", ""));
                    tiet.SetParameterValue(14, modGeneral.Tranlated("T\x00ean h\x00e0ng", ""));
                    tiet.SetParameterValue(15, modGeneral.Tranlated("ĐVT", ""));
                    tiet.SetParameterValue(0x10, modGeneral.Tranlated("Số lượng", ""));
                    tiet.SetParameterValue(0x11, modGeneral.Tranlated("Gi\x00e1 b\x00e1n", ""));
                    tiet.SetParameterValue(0x12, modGeneral.Tranlated("Tiền b\x00e1n", ""));
                    tiet.SetParameterValue(0x13, modGeneral.Tranlated("(%)", ""));
                    tiet.SetParameterValue(20, modGeneral.Tranlated("Hoa hồng", ""));
                    tiet.SetParameterValue(0x15, modGeneral.Tranlated("Thu lại", ""));
                    tiet.SetParameterValue(0x16, modGeneral.Tranlated("STT", ""));
                    tiet.SetParameterValue(0x17, modGeneral.Tranlated("Ng\x00e0y ...... th\x00e1ng ....... năm ..................", ""));
                    tiet.SetParameterValue(0x18, modGeneral.Tranlated("Lập biểu", ""));
                    tiet.SetParameterValue(0x19, modGeneral.Tranlated("Tổng cộng", ""));
                    MyProject.Forms.Frm_ViewReport.ReportViewer.ReportSource = tiet;
                    MyProject.Forms.Frm_ViewReport.ReportViewer.DisplayGroupTree = false;
                    this.Cursor = Cursors.Default;
                    MyProject.Forms.Frm_ViewReport.ShowDialog();
                }
                catch (Exception exception1)
                {
                    ProjectData.SetProjectError(exception1);
                    Exception exception = exception1;
                    MessageBox.Show(exception.Message.ToString());
                    ProjectData.ClearProjectError();
                }
            }
        }

        internal virtual ComboBox CboDonVi
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CboDonVi;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._CboDonVi = value;
            }
        }

        internal virtual Button CmdCancel
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdCancel;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdCancel_Click);
                if (this._CmdCancel != null)
                {
                    this._CmdCancel.Click -= handler;
                }
                this._CmdCancel = value;
                if (this._CmdCancel != null)
                {
                    this._CmdCancel.Click += handler;
                }
            }
        }

        internal virtual Button CmdOK
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdOK;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdOK_Click);
                if (this._CmdOK != null)
                {
                    this._CmdOK.Click -= handler;
                }
                this._CmdOK = value;
                if (this._CmdOK != null)
                {
                    this._CmdOK.Click += handler;
                }
            }
        }

        internal virtual GroupBox GroupBox1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._GroupBox1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._GroupBox1 = value;
            }
        }

        internal virtual Label Label13
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label13;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label13 = value;
            }
        }

        internal virtual Label Label2
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label2;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label2 = value;
            }
        }

        internal virtual Label Label3
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label3;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label3 = value;
            }
        }

        internal virtual RadioButton OptInChiTiet
        {
            [DebuggerNonUserCode]
            get
            {
                return this._OptInChiTiet;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._OptInChiTiet = value;
            }
        }

        internal virtual RadioButton OptInTongHop
        {
            [DebuggerNonUserCode]
            get
            {
                return this._OptInTongHop;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._OptInTongHop = value;
            }
        }

        internal virtual Panel Panel1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Panel1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Panel1 = value;
            }
        }

        internal virtual DateTimePicker TxtDenNgay
        {
            [DebuggerNonUserCode]
            get
            {
                return this._TxtDenNgay;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._TxtDenNgay = value;
            }
        }

        internal virtual DateTimePicker TxtTuNgay
        {
            [DebuggerNonUserCode]
            get
            {
                return this._TxtTuNgay;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._TxtTuNgay = value;
            }
        }
    }
}

